#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <math.h>
int main() {
    int i = 0;

    for (i = 0; i < 10000; i++)
    {
        int tmp = i;
        int sum = 0;
        int carry = 0;
        while (tmp)
        {
            carry++;
            tmp /= 10;
        }
        tmp = i;
        carry--;
        while (carry>0)
        {

            tmp = i;
            int s = pow(10, carry);
            int t;
            t = tmp % s;
            tmp /= pow(10, carry--);
            sum += t * tmp;
        }
        if (sum == i)printf("%d ", sum);
    }

    return 0;
}